﻿Imports System
Imports System.IO
Imports System.Data.OleDb
Imports System.Data
Namespace Arwani
    Partial Class Backend_ManageExhibition
        Inherits System.Web.UI.Page

        Public Sub loadData()
            Dim arwCon As New ArwaniController
            Dim strQ As String = "select id,Title,PageName,Description,keywords from AddSEO"
            Dim dtTable As DataTable = arwCon.ExecuteQuery(strQ)
            Me.dg.DataSource = dtTable
            Me.dg.DataBind()
        End Sub
        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
            If (Session("ADMIN_USER") IsNot Nothing) Then
                If Page.IsPostBack = True Then Exit Sub
                Call loadData()

            Else
                Response.Redirect("Default.aspx")
            End If

        End Sub

        Protected Sub dg_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles dg.ItemCommand
           
            If e.CommandName = "Delete" Then
                Dim arwCon As New ArwaniController
                Dim strQ As String = "Delete from AddSEO where id=" & CInt(e.CommandArgument)
                arwCon.ExecuteNonQuery(strQ)
                Call loadData()
            End If

        End Sub

        Protected Sub dg_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles dg.ItemDataBound
            Try
                Dim lnkDelete As LinkButton = CType(e.Item.FindControl("lnkDelete"), LinkButton)
                lnkDelete.Attributes.Add("onclick", "return confirm('Confirm delete this Page?')")
            Catch ex As Exception
            End Try
        End Sub

       

       
    End Class
End Namespace